/*
 *
 * 名称：八卦
 * 功能：易经的基本八卦功能
 * 作者：清河张
 * 时间：2025.05.11
 *
 */

#ifndef GUA8_H
#define GUA8_H
#include "zhouqi.h"
#include "wuxing.h"

class DANGUA_T : public CT //单卦
{
public:
    enum EGUA
    {
        ZGUA, QIAN, DUII, LIII, ZHEN,
        SHUN, KANN, GENN, KUNN,
        G___ = INVALIDID
    };
    //默认构造函数
    DANGUA_T();
    //全参数构造函数，默认属性配置
    DANGUA_T(int id, const char* name, const char* wname, unsigned y1, unsigned y2, unsigned y3, unsigned a, unsigned b);

    union XIANG{
        unsigned _v : 8;
#pragma pack(push, 1)
        struct
        {
            unsigned _1:1;
            unsigned _2:1;
            unsigned _3:1;
            unsigned _4:1;
            unsigned _5:1;
            unsigned _6:1;
            unsigned _a:1;
            unsigned _b:1;
        };
#pragma pack(pop)
        bool invalid() const;
        XIANG(unsigned v = 0);
        XIANG(unsigned y1, unsigned y2, unsigned y3, unsigned a, unsigned b);
    };

    XIANG xiang() const;
    const char* wname() const;

protected:
private:

    XIANG _xiang;//相
    const char* _wname;//物名

};

typedef ZHOUQI<DANGUA_T, 9> GUA8PARENT;

class GUA8 : public GUA8PARENT
{
public:
    //默认构造函数
    GUA8();
    //初始化到指定对象
    GUA8(int id);
    //使用单个对象初始化
    GUA8(const DANGUA_T& gua8);
    //使用父类初始化
    GUA8(const GUA8PARENT& parent);
    //运算
    GUA8& operator = (const GUA8PARENT& gua8);
    GUA8& operator = (const DANGUA_T& gua8);
    GUA8& operator = (int id);

private:
};


#endif // GUA8_H
